<?php

$selection = &$jobId;

$whs = "WHS_" . $selection;

$SourceDb->add("srcDbWhs", $whs);

/**
 * fetch distinct model from whs
 *
 * ALL : special case and pending
 */
if($selection == "ALL"){

  /**
   * fetch all available whs
   */

  /**
   * fetch all model and copy to a handle
   * and loop foreach whs.
   *
   * Do Model listing and check out
   * foreach model balance
   */

  /**
   *
   */
}else{

  /**
   * fetch distinct model name
   */
  $CFetchers->fetchWhsModel($Db,
                            $SourceDb,
                            $nModel,
                            $lstModel);

  /**
   * foreach model name
   * print out the balance
   */
  echo  "<table border='1' class='dedeq' >\n".
        "<tr>\n".
        "<th> No </th>\n".
        "<th> Model </th>\n".
        "<th> QTY </th>\n".
        "</tr>\n";

  for($iRow = 0; $iRow < $nModel ; $iRow++){

    $CFetchers->fetchWhsBalance($Db,
                                $lstModel["MODEL_ID"][$iRow],
                                $lstModel["UNIT"][$iRow],
                                $SourceDb->fetchValue("srcDbWhs"),
                                $nBal,
                                $qty);

    $stdPropRow = $GJs->jsOnMouseOver("GMisc.chgStyle(\"$iRow\",\"sBlue\");") .
                  $GJs->jsOnMouseOut ("GMisc.chgStyle(\"$iRow\",\"sWhite\");");

    echo  "<tr id='$iRow' ".$stdPropRow.">\n".

          "<td> ".($iRow + 1)." </td>\n".

          "<td> ".$lstModel["MODEL"][$iRow]." </td>\n".

          "<td> ".$qty." </td>\n".

          "</tr>\n";

  }

  echo  "</table><br/>\n";
}

?>